<template>
  <div class="review">
    <div class="title">Оценка пользователей</div>
    <div class="singleList">
      <div class="single-choice">
        <el-radio-group v-model="state.radio">
          <el-radio v-for="(item,index) of state.tagListL" :value="item.id" :key="index">{{ item.translated_name }}</el-radio>
        </el-radio-group>
      </div>
      <div class="rigth_single"></div>
    </div>
    <div class="reviewList">
      <div class="reviewItem" v-for="(item,index) of state.list" :key="index">
        <div class="userImg">
          <img :src="item.avatar" alt="">
        </div>
        <div class="userData">
          <div class="userName">{{ item.username }}</div>
          <div class="timeDq">
            <span>{{ item.created_at }}</span>
            <span style="margin: 0 8px">·</span>
            <span>XL/Синий</span>
          </div>
          <div class="btmList">
            <div class="item">Качество отличное</div>
            <div class="item">Стоит купить</div>
          </div>
          <div class="mark">
            <div class="item">
              <div class="text">Качество продукции</div>
              <el-rate disabled v-model="item.goods_score" size="large"/>
            </div>
            <div class="item">
              <div class="text">Скорость логистики</div>
              <el-rate v-model="item.delivery_score" size="large"/>
            </div>
            <div class="item">
              <div class="text">Обслуживание клиентов</div>
              <el-rate v-model="item.service_score" size="large"/>
            </div>
          </div>
          <div class="content">{{ item.describe }} </div>
          <div class="imgBoxList">
            <div class="item" v-for="itemImg of item.imagesList">
              <img :src="itemImg" alt="">
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import {reactive,onMounted} from 'vue'
import {getGoodsComment} from "@/api/api.ts";
import { useRoute } from 'vue-router'
const route = useRoute()
const state = reactive({
  radio: 3,
  tagListL:[],
  list:[],
  page:{
    page:1,
    limit:10
  }
})

const getGoodsCommentFun = () => {
  getGoodsComment({
    page:state.page.page,
    limit:state.page.limit,
    offer_id:867836995003
  }).then((res: any) => {
    console.log(res)
    if(res.errCode === 0){
      state.list = res.returnData.list
      state.tagListL = res.returnData.tagListL
    }
  })
}
onMounted(() => {
  getGoodsCommentFun()
})
</script>
<style scoped lang="less">
.review {
  .title {
    font-family: Segoe UI, Segoe UI;
    font-weight: bold;
    font-size: 22px;
    color: #333333;
    line-height: 22px;
    text-align: left;
    font-style: normal;
    text-transform: none;
    //margin-top: 20px;
  }

  .singleList {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
  }

  .reviewList {
    margin-top: 40px;

    .reviewItem {
      display: flex;
      padding-bottom: 67px;
      border-bottom: 1px solid #EEEEEE;
      margin-bottom: 40px;

      .userImg {
        width: 58px;
        height: 58px;
        overflow: hidden;
        //border-radius: 48px;
        margin-right: 20px;

        img {
          width: 100%;
          border-radius: 48px;
        }
      }

      .userData {
        .userName {
          font-family: Segoe UI, Segoe UI;
          font-weight: 600;
          font-size: 18px;
          color: #333333;
          line-height: 18px;
          text-align: left;
          font-style: normal;
          text-transform: none;
        }

        .timeDq {
          margin-top: 8px;
          font-family: Segoe UI, Segoe UI;
          font-weight: 600;
          font-size: 14px;
          color: #999999;
          line-height: 14px;
          text-align: left;
          font-style: normal;
          text-transform: none;
        }

        .btmList {
          display: flex;

          .item {
            margin-top: 16px;
            margin-right: 16px;
            padding: 4px 8px;
            background: #0070E9;
            border-radius: 8px 8px 8px 8px;
            display: flex;
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
          }
        }

        .mark {
          display: flex;
          //margin-top: 16px;
          .item {
            display: flex;
            align-items: center;
            margin-right: 61px;

            .text {
              font-family: PingFang SC, PingFang SC;
              font-weight: 500;
              font-size: 14px;
              color: #999999;
              line-height: 14px;
              text-align: left;
              font-style: normal;
              text-transform: none;
              margin-right: 16px;
            }
          }
        }

        .content {
          font-family: PingFang SC, PingFang SC;
          font-weight: 500;
          font-size: 14px;
          color: #333333;
          line-height: 21px;
          text-align: left;
          font-style: normal;
          text-transform: none;
        }

        .imgBoxList {
          display: flex;
          margin-top: 20px;

          .item {
            width: 280px;
            height: 280px;
            overflow: hidden;
            margin-right: 16px;
            border-radius: 8px;

            img {
              width: 100%;
              height: 100%;
            }
          }
        }
      }
    }
  }
}
</style>
